﻿using MESPro.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace MESPro.Views
{
    public partial class MsgBoxFrm : DockContent
    {
        public MsgBoxFrm()
        {
            InitializeComponent();
            listView1.Columns[1].Width = listView1.ClientSize.Width - listView1.Columns[0].Width;
            this.SizeChanged += (sender, e1) => { listView1.Columns[1].Width = listView1.ClientSize.Width - listView1.Columns[0].Width; };
        }
        internal void ShowMsg(object msg, MsgLevel level)
        {
            ListViewItem item = new ListViewItem();
            item.ForeColor = Color.Red;
            item.ImageKey = $"{level.ToString()}.ico";
            item.Text = DateTime.Now.ToString();
            item.SubItems.Add(msg.ToString());
            this.listView1.Items.Insert(0, item);
        }

        private void 清空ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.listView1.Items.Clear();
        }
    }
}
